<#include "/common/taglibs.ftl" />
<@menu code='${entityName!}'/>
<#assign op="op.add"/>
<title><@spring.message code="group.type.user" /> - <@spring.message code="${op}" /></title>
<div class="m-portlet">
    <div class="m-portlet__head">
        <div class="m-portlet__head-caption">
            <div class="m-portlet__head-title">
                <span class="m-portlet__head-icon">
                    <i class="flaticon-calendar"></i>
                </span>
                <h3 class="m-portlet__head-text m--font-primary">
                    <@spring.message code="group.type.user" /> / <@spring.message code="${op}" />
                    <#if op != 'op.view'>
                    （<@spring.message code="reuqired.tips"/>）
                    </#if>
                </h3>
            </div>
        </div>
        <div class="m-portlet__head-tools">
            <a data-toggle="m-tooltip" class="btn m-btn m-btn--icon m-btn--icon-only m-btn--pill btn-outline-metal m--margin-right-10" href="<@BackURL/>" title="<@spring.message code="button.back.tips"/>">
                <i class="la la-undo"></i>
            </a>
        </div>
    </div>
    <!--begin::Form-->
    <form class="m-form m-form--fit m-form--label-align-right" method="post" id="mainForm">
        <@BackURL hiddenInput="true"/>
        <div class="m-portlet__body">
            <div class="m-form__content">
                <#include "/common/taglibs/validationMessage.ftl">
            </div>
            <div class="form-group m-form__group row">
                <label class="col-form-label col-lg-3 col-sm-12"><@spring.message code="user"/><span class="required"> * </span></label>
                <div class="col-lg-4 col-md-9 col-sm-12">
                    <#if op == 'op.add'>
                        <select id="user-select" name="ids" class="form-control m-select" multiple></select>
                    <#else>
                        <p class="form-control-static"> <button type="button" class="btn green btn-xs">${(mUser.name)!'Not found'}</button> </p>
                        <input type="hidden" name="userId" value="${(m.userId)!}"/>
                    </#if>
                </div>
            </div>
        </div>
        <div class="m-portlet__foot m-portlet__foot--fit">
            <div class="m-form__actions m-form__actions--solid">
                <div class="row">
                    <div class="col-lg-9 ml-lg-auto">
                    <#if op != 'op.view'>
                        <button data-toggle="m-tooltip" type="submit" class="btn m-btn m-btn--icon m-btn--wide m-btn--md btn-brand m--margin-right-10" title='<@spring.message code="button.submit"/>'> <span><i class="la la-check-circle"></i> <span><@spring.message code="button.submit"/></span></span></button>
                        <button data-toggle="m-tooltip" type="reset" class="btn m-btn m-btn--icon m-btn--wide m-btn--md btn-warning m--margin-right-10" title='<@spring.message code="button.reset"/>'> <span><i class="la la-eraser"></i> <span><@spring.message code="button.reset"/></span></span></button>
                    </#if>
                        <a data-toggle="m-tooltip" class="btn m-btn m-btn--icon m-btn--wide m-btn--md btn-secondary m--margin-right-10" href="<@BackURL/>" title='<@spring.message code="button.cancel"/>'> <span><i class="la la-ban"></i> <span><@spring.message code="button.cancel" /></span></span></a>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <!--end::Form-->
</div>
<page-plugin-style>
</page-plugin-style>
<page-plugin-script>
</page-plugin-script>
<page-style>
</page-style>
<page-script>
	<script>
        jQuery(document).ready(function() {
            var $form = $("#mainForm")
            $.m.form.initSelect($('#user-select'), {
                ajax : {
                    url : "${ctx}/system/account/user/ajax/select/search"
                }
            });
            $.m.form.validate($form, {
                rules: {
                    ids: {
                        required: true
                    }
                }
            });
        });
	</script>
</page-script>